/* 
 * File:   EXEC.h
 * Author: Saulo
 *
 * Created on 23 de Maio de 2010, 22:10
 */

#ifndef _EXEC_H
#define	_EXEC_H

#include <string>
#include <iostream>
#include <vector>
#include <map>
#include "operacoes.h"
#include "registradores.h"
#include "IF.h"
#include "estruturas.h"

using namespace std;

class EXEC {

    enum StringInstructions {
        add, addinc, iand, andnota, deca, inca, j, lsl, lsr,
        nand, nor, ones, ior, ornotb, passa, passnota, sub, subdec, ixnor, ixor, zeros,
        addi
    };

    enum StringRegs {
        rt0, rt1, rt2, rt3, rt4, rt5, rt6, rt7
    };



public:
    EXEC(registradores* _regs, IF* _iF);
    void executa(vector<string> instrucoes);
    EXEC(const EXEC& orig);
    virtual ~EXEC();
    bufferEXEC getBuffer();
private:
    void Initialize();
    reg escolhe(string id);
    void setBuffer(reg tmp, string id);
    void setBuffer();
    operacoes* op;
    registradores* regs;
    IF* iF;
    std::map<std::string, StringInstructions> s_mapStringInstructions;
    std::map<std::string, StringRegs> s_mapStringRegs;
    bufferEXEC buffer;

};

#endif	/* _EXEC_H */

